import request from '@/utils/request'
import { data } from 'autoprefixer'

export const getEmployee = (params) => {
  return request({ url: '/sys/user', params })
}

export const exportEmployee = () => {
  return request({ url: '/sys/user/export', responseType: 'blob' })
}

export const exportEmployeeTemplate = () => {
  return request({ url: '/sys/user/import/template', responseType: 'blob' })
}

export const importEmployeeExcel = (data) => {
  return request({ url: '/sys/user/import', method: 'POST', data })
}

export const deleteEmployee = (id) => {
  return request({ url: `/sys/user/${id}`, method: 'DELETE' })
}

export const addEmployee = (data) => {
  return request({ url: '/sys/user', method: 'POST', data })
}

export const getEmployeeDetail = (id) => {
  return request({ url: `/sys/user/${id}` })
}

export const updateEmployee = (data) => {
  return request({ url: `/sys/user/${data.id}`, method: 'PUT', data })
}

export const enabledRoleList = () => {
  return request({ url: '/sys/role/list/enabled' })
}

export const assignRole = (data) => {
  return request({ url: '/sys/user/assignRoles', method: 'PUT', data })
}
